home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tools / packer / xfd / include / libraries / xfdmaster.h < prev    next >
C/C++ Source or Header  |  1995-03-09  |  6KB  |  175 lines

  1. #ifndef LIBRARIES_XFDMASTER_H
  2. #define LIBRARIES_XFDMASTER_H
  3.  
  4. /*
  5. **    $VER: xfdmaster.h 34.1 (19.9.94)
  6. **
  7. **    Copyright © 1994 by Georg Hörmann.
  8. **    All Rights Reserved.
  9. */
  10.  
  11. #ifndef EXEC_LIBRARIES_H
  12. #include <exec/libraries.h>
  13. #endif
  14.  
  15. /*********************
  16. *                    *
  17. *    Library Base    *
  18. *                    *
  19. *********************/
  20.  
  21. struct xfdMasterBase {
  22.     struct Library LibNode;
  23.     ULONG    xfdm_SegList;        /* PRIVATE! */
  24.     APTR    xfdm_DosBase;
  25.     APTR    xfdm_FirstSlave;
  26.     APTR    xfdm_FirstForeman;    /* PRIVATE! */
  27. };
  28.  
  29. #define XFDM_VERSION    34        /* for OpenLibrary() */
  30. #define XFDM_NAME    "xfdmaster.library"
  31.  
  32. /********************
  33. *                   *
  34. *    Buffer Info    *
  35. *                   *
  36. ********************/
  37.  
  38. struct xfdBufferInfo {
  39.     APTR    xfdbi_SourceBuffer;    /* Pointer to source buffer */
  40.     ULONG    xfdbi_SourceBufLen;    /* Length of source buffer */
  41.     APTR    xfdbi_Slave;        /* PRIVATE! */
  42.     STRPTR    xfdbi_PackerName;    /* Name of recognized packer */
  43.     UWORD    xfdbi_PackerFlags;    /* Flags for recognized packer */
  44.     UWORD    xfdbi_Error;        /* Error return code */
  45.     APTR    xfdbi_TargetBuffer;    /* Pointer to target buffer */
  46.     ULONG    xfdbi_TargetBufMemType;    /* Memtype of target buffer */
  47.     ULONG    xfdbi_TargetBufLen;    /* Full length of buffer */
  48.     ULONG    xfdbi_TargetBufSaveLen;    /* Used length of buffer */
  49.     ULONG    xfdbi_DecrAddress;    /* Address to load decrunched file */
  50.     ULONG    xfdbi_JmpAddress;    /* Address to jump in file */
  51.     APTR    xfdbi_Special;        /* Special decrunch info (eg. password) */
  52. };
  53.  
  54. #define xfdbi_MaxSpecialLen xfdbi_Error    /* Max. length of special info */
  55.  
  56. /*********************
  57. *                    *
  58. *    Segment Info    *
  59. *                    *
  60. *********************/
  61.  
  62. struct xfdSegmentInfo {
  63.     ULONG    xfdsi_SegList;        /* BPTR to segment list */
  64.     APTR    xfdsi_Slave;        /* PRIVATE! */
  65.     STRPTR    xfdsi_PackerName;    /* Name of recognized packer */
  66.     UWORD    xfdsi_PackerFlags;    /* Flags for recognized packer */
  67.     UWORD    xfdsi_Error;        /* Error return code */
  68.     APTR    xfdsi_Special;        /* Special decrunch info (eg. password) */
  69.     UWORD    xfdsi_RelMode;        /* (V34) Relocation mode */
  70.     UWORD    xfdsi_Reserved0;    /* (V34) Reserved */
  71. };
  72.  
  73. #define xfdsi_MaxSpecialLen xfdsi_Error    /* Max. length of special info */
  74.  
  75. /********************
  76. *                   *
  77. *    Error Codes    *
  78. *                   *
  79. ********************/
  80.  
  81. #define XFDERR_OK        $0000    /* No errors */
  82.  
  83. #define XFDERR_NOMEMORY        $0001    /* Error allocating memory */
  84. #define XFDERR_NOSLAVE        $0002    /* No slave entry in info structure */
  85. #define XFDERR_NOTSUPPORTED    $0003    /* Slave doesn't support called function */
  86. #define XFDERR_UNKNOWN        $0004    /* Unknown file */
  87. #define XFDERR_NOSOURCE        $0005    /* No sourcebuffer/seglist specified */
  88. #define XFDERR_WRONGPASSWORD    $0006    /* Wrong password for decrunching */
  89. #define XFDERR_BADHUNK        $0007    /* Bad hunk structure */
  90. #define XFDERR_CORRUPTEDDATA    $0008    /* Crunched data is corrupted */
  91. #define XFDERR_MISSINGRESOURCE    $0009    /* (V34) Missing resource (eg. library) */
  92.  
  93. #define XFDERR_UNDEFINEDHUNK    $1000    /* (V34) undefined hunk type */
  94. #define XFDERR_NOHUNKHEADER    $1001    /* (V34) file is not executable */
  95. #define XFDERR_BADEXTTYPE    $1002    /* (V34) bad hunk_ext type */
  96. #define XFDERR_BUFFERTRUNCATED    $1003    /* (V34) unexpected end of file */
  97. #define XFDERR_WRONGHUNKAMOUNT    $1004    /* (V34) wrong amount of hunks */
  98.  
  99. #define XFDERR_UNSUPPORTEDHUNK    $2000    /* (V34) hunk type not supported */
  100. #define XFDERR_BADRELMODE    $2001    /* (V34) unknown XFDREL_#? mode */
  101.  
  102. /*******************************
  103. *                              *
  104. *    Relocation Modes (V34)    *
  105. *                              *
  106. *******************************/
  107.  
  108. #define XFDREL_DEFAULT        $0000    /* Use memory types given by hunk_header */
  109. #define XFDREL_FORCECHIP    $0001    /* Force all hunks to chip ram */
  110. #define XFDREL_FORCEFAST    $0002    /* Force all hunks to fast ram */
  111.  
  112. /*************************************
  113. *                                    *
  114. *    Values for xfd??_PackerFlags    *
  115. *                                    *
  116. *************************************/
  117.  
  118. /* Bit numbers */
  119. #define XFDPFB_RELOC    0    /* Relocatible file packer */
  120. #define XFDPFB_ADDR    1    /* Absolute address file packer */
  121. #define XFDPFB_DATA    2    /* Data file packer */
  122.  
  123. #define XFDPFB_PASSWORD    4    /* Packer requires password */
  124. #define XFDPFB_RELMODE    5    /* (V34) Decruncher supports xfdsi_RelMode */
  125.  
  126. /* Bit masks */
  127. #define XFDPFF_RELOC    (1<<XFDPFB_RELOC)
  128. #define XFDPFF_ADDR    (1<<XFDPFB_ADDR)
  129. #define XFDPFF_DATA    (1<<XFDPFB_DATA)
  130.  
  131. #define XFDPFF_PASSWORD    (1<<XFDPFB_PASSWORD)
  132. #define XFDPFF_RELMODE    (1<<XFDPFB_RELMODE)
  133.  
  134. /****************
  135. *               *
  136. *    Foreman    *
  137. *               *
  138. ****************/
  139.  
  140. struct xfdForeMan {
  141.     ULONG    xfdf_Security;        /* moveq #-1,d0 ; rts */
  142.     ULONG    xfdf_ID;        /* Set to XFDF_ID */
  143.     UWORD    xfdf_Version;        /* Set to XFDF_VERSION */
  144.     UWORD    xfdf_Reserved;        /* Not used by now, set to NULL */
  145.     ULONG    xfdf_Next;        /* PRIVATE! */
  146.     ULONG    xfdf_SegList;        /* PRIVATE! */
  147.     APTR    xfdf_FirstSlave;    /* First slave (see below) */
  148. };
  149.  
  150. #define XFDF_ID        (('X'<<24)|('F'<<16)|('D'<<8)|('F'))
  151. #define XFDF_VERSION    1
  152.  
  153. /**************
  154. *             *
  155. *    Slave    *
  156. *             *
  157. **************/
  158.  
  159. struct xfdSlave {
  160.     APTR    xfds_Next;        /* Next slave (or NULL) */
  161.     UWORD    xfds_Version;        /* Set to XFDS_VERSION */
  162.     UWORD    xfds_MasterVersion;    /* Minimum XFDM_VERSION required */
  163.     STRPTR    xfds_PackerName;    /* Name of packer ('\0' terminated) */
  164.     UWORD    xfds_PackerFlags;    /* Flags for packer */
  165.     UWORD    xfds_MaxSpecialLen;    /* Max. length of special info (eg. password) */
  166.     APTR    xfds_RecogBuffer;    /* APTR to buffer recognition code (or NULL) */
  167.     APTR    xfds_DecrunchBuffer;    /* APTR to buffer decrunch code (or NULL) */
  168.     APTR    xfds_RecogSegment;    /* APTR to segment recognition code (or NULL) */
  169.     APTR    xfds_DecrunchSegment;    /* APTR to segment decrunch code (or NULL) */
  170. };
  171.  
  172. #define XFDS_VERSION    1
  173.  
  174. #endif /* LIBRARIES_XFDMASTER_H */
  175.